#ifndef E95E1BF3_6766_4F23_A128_00FE070A66E0
#define E95E1BF3_6766_4F23_A128_00FE070A66E0

#include <iostream>
#include <cstring>
#include <string>
#include <ctime>


char opers[5] = {'+','-','*','/','%'};

enum {
	Diverror = 1,
	Moderror
};

class Task
{
public:
	Task()
	{}
	Task(int x, int y, char op) : data1_(x), data2_(y), opers_(op), result_(0), exitcode_(0)
	{
	}
	void run()
	{
		switch (opers_)
		{
		case '+':
			result_ = data1_ + data2_;
			break;
		case '-':
			result_ = data1_ - data2_;
			break;
		case '*':
			result_ = data1_ * data2_;
			break;
		case '/':
			if(data2_ == 0){
				exitcode_ = Diverror;
				break;
			}
			result_ = data1_ / data2_;
			break;
		case '%':
			if(data2_ == 0){
				exitcode_ = Moderror;
				break;
			}
			result_ = data1_ % data2_;
			break;
		default:
			exitcode_ = -1;
			break;
		}
	}
	void operator()()
	{
		run();
	}
	std::string Getresult()
	{
		std::string s = std::to_string(data1_) + opers_ + std::to_string(data2_);
		s += '=';
		s += std::to_string(result_);
		s += '[';
		s += "code: ";
		s += std::to_string(exitcode_);
		s += ']'; 
		return s;
	}
	std::string GetTask()
	{
		std::string s = std::to_string(data1_) + opers_ + std::to_string(data2_);
		s += '=';
		s += '?';
		return s;
	}

private:
	int data1_;
	int data2_;
	char opers_;

	int result_;
	int exitcode_;
};

#endif /* E95E1BF3_6766_4F23_A128_00FE070A66E0 */
